The invention proceeds from an electrical machine comprising a fastening flange. The fastening flange serves to fasten the electrical machine to an object. The object can be a body of a motor vehicle, or a device which is to be adjusted by the electrical machine. Electrical machines comprising a fastening flange are known, as shown in DE 10 2013 224 02. In this electrical machine, the fastening flange bears against a housing part of the electrical machine by way of a raised portion. Projections are fitted to the fastening flange in the region of the raised portions, wherein the projections extend radially starting from the fastening flange. In this case, the projections are arranged on a rim which runs around the electrical machine in a closed manner and is part of the fastening flange. In this case, the rim extends radially outward starting from the fastening flange. Forming of the raised portions, which are integrally formed from the fastening flange, causes deformation of the rim and, as a result, incorrect positioning of the projections.